package team.yidong.fenda.wx.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import redis.clients.jedis.Jedis;
import team.yidong.fenda.wx.Service.WxPraiseService;


@Controller
public class WxPraiseController {
    @Autowired
    WxPraiseService wxPraiseService;

    /**
     * 答案点赞
     *
     * @param wxNumber
     * @param answerId
     * @return
     */
    @RequestMapping("/wx/praise")
    @ResponseBody
    public String givePraise(@RequestParam String wxNumber, Integer answerId) {
        Jedis jedis = new Jedis("localhost");
        wxNumber = jedis.get(wxNumber);
        return wxPraiseService.praise(answerId, wxNumber);
    }

}
